<%@ page language="java" import="java.util.*" import="java.sql.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0022)http://blog.csdn.net/electroniXtar/ -->
<html>
<%String userid = session.getAttribute("pid").toString(); 
String authorid = request.getParameter("authorid"); 
%>
<%String blogname = request.getParameter("blogname"); %>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="blog.anchen8.net" />
<title>毕业生，你的选择</title>
<link rel="stylesheet" type="text/css" href="../css/personal.css" />
<link rel="stylesheet" type="text/css" href="../css/WriteBlog.css" />
<script src="../js/jQuery1.82.js" type="text/javascript"></script>
<script type="text/javascript">
        function createMain(){
            var _scrollWidth=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
            var _scrollHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
                document.getElementById("main").style.left=(_scrollWidth-950)/2+"px";
               // document.getElementById("m").style.height=_scrollHeight+"px";
        }
        function naviover(val){
            document.getElementById(val).style.backgroundColor="#E1DACF";
        }
        function naviout(val){
            document.getElementById(val).style.backgroundColor="#C5C5C5";
        }
        $(document).ready(function() {
			/*	2nd example	*/
			
			$("#menu2 li a").wrapInner( '<span class="out"></span>' );
			
			$("#menu2 li a").each(function() {
				$( '<span class="over">' +  $(this).text() + '</span>' ).appendTo( this );
			});

			$("#menu2 li a").hover(function() {
				$(".out",	this).stop().animate({'top':	'45px'},	200); // move down - hide
				$(".over",	this).stop().animate({'top':	'0px'},		200); // move down - show

			}, function() {
				$(".out",	this).stop().animate({'top':	'0px'},		200); // move up - show
				$(".over",	this).stop().animate({'top':	'-45px'},	200); // move up - hide
			});

		});
    </script>
</head>
<body class="body">
	<jsp:useBean id="sql" scope="page" class="com.tzq.JAVABEAN.ConnectDB" />
	<%if(userid==null){%>
	<jsp:forward page="/Public/PublicMainPage.jsp"></jsp:forward>
	<%}
	String blogName="";
	String blogText="";
	String usernameString = "";
	boolean flag = userid.equals(authorid);
	if(flag){
		ResultSet rs=sql.executeQuery("select BlogName,BlogContext,UserName from Blog,Userinfo where AuthorID=UserID AND  AuthorID="+authorid+" and BlogName='"+blogname+"'");
		if(rs.next()){
			blogName=rs.getString("BlogName");                   
			blogText=rs.getString("BlogContext");
			usernameString = rs.getString("UserName");
	}
	}
	%>
	<div class="main" id="main">
		<span class="title"><%=usernameString %>的空间</span>
		<div id="menu2" class="menu">
			<ul>
				<li id="info"><a href="/Bys-Website/PersonMainPage.jsp?userID=<%=userid%>">个人信息</a></li>
				<li id="video"><a href="/Bys-Website/PersonVideo/MyVideo.jsp?userid=<%=userid %>">个人视频</a></li>
				<li id="photo"><a href="/Bys-Website/PersonImage/MyImage.jsp?userid=<%=userid%>">个人相册</a></li>
				<li id="blog"><a href="/Bys-Website/PersonBlog/MyBlog.jsp?userid=<%=userid%>">个人博客</a></li>
				<li><a href="javascript:;">Contacts</a></li>
			</ul>
		</div>
		<div id="blogde">
		<%if(flag){
			%>
		<form action="WriteBlogServlet?method=1&OldBlogName=<%=blogName%>"
	method="post">
			<div class="blogtitle">
				&nbsp;编辑博客
					<input type="submit" value="保存"/>
			</div>
			<div class="blogcontext">
				<div class="heretitle">
					<h1>标题</h1>
						<input type="text" value=<%=blogName%> name="BlogTitle"/>
				</div>
				<div class="text">
					<textarea name="BlogArticle"><%=blogText%></textarea>
				</div>
			</div>
		</form>
		<%sql.closeConnection();} 
else{
	response.sendRedirect("Public/PublicMainPage.jsp");
}%>
		</div>
	</div>
	<script>    
        createMain();
    </script>
	<div class="topbar">
		<div class="logo">
			<a href="/Bys-Website/Public/home.jsp">
	           	<img src="/Bys-Website/SourceImageFile/toplogo.jpg"/>
			</a>
		</div>
		<div class="navi">
			<ul class="naviul">
				<li><a href="/Bys-Website/Public/Video.jsp" class="outli">视频</a></li>
				<li><a href="/Bys-Website/Public/Photo.jsp" class="outli">相册</a></li>
				<li><a href="/Bys-Website/Public/Blog.jsp" class="inli">博客</a></li>
			</ul>
		</div>
		<div class="loginfo">
			<ul class="loginfoul">
				<%if(session.getAttribute("pid")==null){%>
				<li><a href="/Bys-Website/Log_in.jsp">登录</a></li>
				<li><a href="/Bys-Website/Regist.jsp">注册</a></li>
			<%}else{
				 String Sessionid=session.getAttribute("pid").toString();%>
				<li><a href="../PersonMainPage.jsp?userID=<%=Sessionid  %>"><%=session.getAttribute("username").toString()%></a></li>
				<li><a href="../LoginServlet?method=1">退出</a></li>
			<%}%>
			</ul>
		</div>
	</div>
</body>
</html>